package cn.edu.ctbu.sbadmin.school.dao;

import cn.edu.ctbu.sbadmin.common.core.MyMapper;

import cn.edu.ctbu.sbadmin.common.domain.QueryPagePara;
import cn.edu.ctbu.sbadmin.school.domain.DimClass;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 关注公众号：MarkerHub
 * @since 2021-06-17
 */
public interface DimClassMapper extends MyMapper<DimClass> {


    @Select("SELECT\n" +
            "dim_class.id,\n" +
            "dim_class.class_name,\n" +
            "dim_class.class_person_number,\n" +
            "dim_class.course_name,\n" +
            "dim_class.course_type,\n" +
            "dim_class.teacher_id,\n" +
            "dim_class.term_id,\n" +
            "dim_class.create_time,\n" +
            "dim_term.`name` AS term_name,\n" +
            "sys_user.truename AS user_name\n" +
            "FROM\n" +
            "dim_class\n" +
            "LEFT JOIN sys_user ON dim_class.teacher_id = sys_user.id\n" +
            "LEFT JOIN dim_term ON dim_class.term_id = dim_term.id\n"+
            "${ew.customSqlSegment}"
    )


    IPage<DimClass> selectPage(IPage<DimClass> page, @Param(Constants.WRAPPER) QueryWrapper<DimClass> queryWrapper);

//    public List<DimClass> getAll();
//    /**
//     * 查询视图
//     * @param
//     * @return
//     */
//    public List<DimClass> listView(QueryPagePara mQuery);
//
//    /**
//     * 查询计数
//     * @param
//     * @return
//     */
//    public int countView(QueryPagePara mQuery);



}
